import { Controller, Get, Logger } from '@nestjs/common'
import { ApiOperation, ApiTags } from '@nestjs/swagger'

import { ApiSecurityAuth } from '~/common/decorators/swagger.decorator'
import { HomeCountDto, SportCountDto } from '~/modules/health/data/data.dto'
import { DataService } from './data.service'

@ApiTags('Health - 数据模块')
@ApiSecurityAuth()
@Controller('data')
export class DataController {
  private logger = new Logger(DataController.name)

  constructor(
    private dataService: DataService,
  ) { }

  @Get('homeCount')
  @ApiOperation({ summary: '主页统计' })
  async homeCount(): Promise<HomeCountDto> {
    return this.dataService.homeCount()
  }

  @Get('sportCount')
  @ApiOperation({ summary: '运动统计' })
  async sportCount(): Promise<SportCountDto[]> {
    return this.dataService.sportCount()
  }
}
